/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spring.modelo.entidad;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ricardo
 */
@Entity
@Table(name = "Carrera")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Carrera.findAll", query = "SELECT c FROM Carrera c"),
    @NamedQuery(name = "Carrera.findByCodCarrera", query = "SELECT c FROM Carrera c WHERE c.codCarrera = :codCarrera"),
    @NamedQuery(name = "Carrera.findByDescCarrera", query = "SELECT c FROM Carrera c WHERE c.descCarrera = :descCarrera"),
    @NamedQuery(name = "Carrera.findByActivo", query = "SELECT c FROM Carrera c WHERE c.activo = :activo")})
public class Carrera implements Serializable {
    @OneToMany(mappedBy = "codCarrera")
    private Collection<Planes> planesCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "codCarrera")
    private String codCarrera;
    @Size(max = 100)
    @Column(name = "descCarrera")
    private String descCarrera;
    @Column(name = "activo")
    private Boolean activo;

    public Carrera() {
    }

    public Carrera(String codCarrera) {
        this.codCarrera = codCarrera;
    }

    public String getCodCarrera() {
        return codCarrera;
    }

    public void setCodCarrera(String codCarrera) {
        this.codCarrera = codCarrera;
    }

    public String getDescCarrera() {
        return descCarrera;
    }

    public void setDescCarrera(String descCarrera) {
        this.descCarrera = descCarrera;
    }

    public Boolean getActivo() {
        return activo;
    }

    public void setActivo(Boolean activo) {
        this.activo = activo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codCarrera != null ? codCarrera.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Carrera)) {
            return false;
        }
        Carrera other = (Carrera) object;
        if ((this.codCarrera == null && other.codCarrera != null) || (this.codCarrera != null && !this.codCarrera.equals(other.codCarrera))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.spring.modelo.entidad.Carrera[ codCarrera=" + codCarrera + " ]";
    }

    @XmlTransient
    public Collection<Planes> getPlanesCollection() {
        return planesCollection;
    }

    public void setPlanesCollection(Collection<Planes> planesCollection) {
        this.planesCollection = planesCollection;
    }
    
}
